﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CPPEI.WorkflowCore.Simulator
{
    public class WorkflowStorage : IWorkflowStorage
    {
        List<Workflow> _list = new List<Workflow>();

        public Workflow Find(string code)
        {
            return _list.SingleOrDefault(p => p.Code == code);
        }

        public Workflow Find(string code, Version version)
        {
            throw new NotImplementedException();
        }

        public Workflow Find(Guid id)
        {
            throw new NotImplementedException();
        }

        public void Save(Workflow workflow)
        {
            if(_list.SingleOrDefault(p=>p.Code == workflow.Code) == null)
            {
                _list.Add(workflow);
            }
        }

        public void Remove(Workflow workflow)
        {
            throw new NotImplementedException();
        }
    }
}
